#pragma once

#include "disjointsets.h"

#define EPS 1e-6
#define FP float

class point3d
{
public:
	float coords[3];

	inline friend bool operator==(const point3d &a, const point3d &b)	
	{
		FP dist2 = 0.0;

		for(int i = 0; i < 3; i++)
			dist2 += (a.coords[i] - b.coords[i]) * (a.coords[i] - b.coords[i]);
			if(dist2 > EPS)
				return false;

		return true;

	}
	friend bool operator<(const point3d &a, const point3d &b)	
	{ 
		if(a == b)
			return false;

		for(int i = 0; i < 3; i++)
			if(a.coords[i] > b.coords[i])
				return true;
			else if(a.coords[i] < b.coords[i])
				return false;

		return false;
	}
	friend bool operator>(const point3d &a, const point3d &b)	
	{ 
		for(int i = 0; i < 3; i++)
			if(a.coords[i] < b.coords[i])
				return true;
			else if(a.coords[i] > b.coords[i])
				return false;

		return false;
	}
};

class triangle3d
{
public:
	point3d points[3];
	int color;
};
